package com.tyf.tool;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import memServer.business.BusinessServer;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.google.gson.Gson;
import com.tyf.jms.MessageSender;
import com.tyf.model.ActionBody;
import com.tyf.model.ActionHeader;
import com.tyf.model.ActionMessage;

/**测试
 * @author 周广文:15146639681
 *
 * 2016年5月12日
 */
public class Tester {
	private static MessageSender sender = getMessageSender("springJMSConfiguration.xml");

	public static void send(String msg) {
		sender.send(msg);
	}

	public static MessageSender getMessageSender(String configLocation) {
		ApplicationContext context = new ClassPathXmlApplicationContext(configLocation);
		return (MessageSender) context.getBean("messageSender");

	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		 Gson gson = new Gson();
//			ActionMessage msg = new ActionMessage();
//			ActionHeader head = new ActionHeader();
//			ActionBody body = new ActionBody();
//			Map map = new HashMap();
//			head.setTime(DateUtil.getNow());
//			head.setClientName("OBDSERVER");
//			head.setBizType("WIFI");
//			map.put("password", "12345678");
//			map.put("obdId", "eec6d883d6fde07c");
//			map.put("clientTime", System.currentTimeMillis()/1000);
//			map.put("kaiguan", "1");
//			body.setData(map);
//			msg.setHead(head);
//			msg.setBody(body);
//			System.out.println(gson.toJson(msg));
//			sender.send(gson.toJson(msg),"receivelistlog");
		Map map=new HashMap();
		Map a1=new HashMap();
		a1.put("baoe", "6T");
		a1.put("bj", "1");
		map.put("1", a1);
		BusinessServer.getInstance().delKey("tttttcsEGS");
		System.out.println(BusinessServer.getInstance().getValidData("1", "tttttcsEGS")); 
		System.out.println(BusinessServer.getInstance().getValidData("1", "tttttEGS"));
		
		
//		sender.send("{\"head\":{\"time\":\"2016-10-17 14:33:49\",\"bizType\":\"InGS\",\"clientName\":\"OBDSERVER\"},\"body\":{\"data\":{\"client_tiem\":\"2016-10-17 14:33:49\",\"username\":\"周广文\",\"plate_num\":\"黑A12345\",\"car_type\":\"1\",\"obd_id\":\"ttttt\",\"tollbooth_num\":\"0008\"}}}","receivelistlog");
		sender.send("{\"head\":{\"time\":\"2016-10-17 15:11:46\",\"bizType\":\"OutGS\",\"clientName\":\"OBDSERVER\"},\"body\":{\"data\":{\"client_tiem\":\"2016-10-17 15:11:46\",\"username\":\"周广文\",\"plate_num\":\"黑A12345\",\"car_type\":\"1\",\"in_name\":\"入口站名称\",\"in_id\":\"123\",\"in_time\":\"2016-10-17 15:11:46\",\"order_time\":\"1:23:55\",\"mileage\":\"80\",\"tollbooths\":[{\"tollbooth_name\":\"A站\",\"tollbooth_num\":\"2\",\"deatil_out_time\":\"A站\"},{\"tollbooth_name\":\"B站\",\"tollbooth_num\":\"3\",\"deatil_out_time\":\"B站\"},{\"tollbooth_name\":\"C站\",\"tollbooth_num\":\"4\",\"deatil_out_time\":\"C站\"},{\"tollbooth_name\":\"D站\",\"tollbooth_num\":\"5\",\"deatil_out_time\":\"D站\"},{\"tollbooth_name\":\"V站\",\"tollbooth_num\":\"7\",\"deatil_out_time\":\"V站\"}],\"order_number\":\"1477968447\",\"gpslist\":[],\"obd_id\":\"ttttt\",\"tollbooth_num\":\"0008\"}}}","receivelistlog");
		
	}

}
